fix(agent-core): prepend repeat reminders so they survive oversized-result truncation - #2176
fix(agent-core): prepend repeat reminders so they survive oversized-result truncation#2176vincentllm wants to merge 3 commits into
Conversation
…esult truncation The dedupe repeat reminders (streak 3/5/8) were appended at the tail of the tool output, but the oversized-result offload path keeps only a 2K head preview, so the reminder was silently cut off exactly in the large-output scenarios where repeat loops are most likely. Prepend the reminder ahead of the output in both engines (agent-core, agent-core-v2) and add regression tests covering the truncation window.
🦋 Changeset detectedLatest commit: 36a656f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…ation in regression tests
c64dd94 to
1b3c785
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b3c785e0c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…lean up per review
|
Post-fix T4 validation is complete. Full methods and results are posted on the linked issue: #2177 (comment) Short version:
So the defensible claim is narrow: the patch repairs reminder visibility. The behavioral correctness gain from that repair alone is not statistically established, and effort is not a monotonic accuracy control across task families. |
Related Issue
Resolve #2177
Problem
See linked issue. In short: the dedupe repeat reminders (streak 3/5/8) are appended at the tail of the tool output, and the oversized-result offload path keeps only a 2K head preview — so the reminders are silently discarded for any tool result >50K chars, in both v1 (
agent-core) and v2 (agent-core-v2). The turn's only remaining guardrail is the streak-12 force stop.What changed
agent/turn/tool-dedup.ts(v1) andagent/toolDedupe/toolDedupeService.ts(v2): the reminder is now prepended ahead of the result output instead of appended at the tail, so it survives the head-only truncation preview. A comment documents the ordering constraint.ContentPart[]assertions that assumed tail placement were updated.@moonshot-ai/kimi-codepatch.Note: I could not run
pnpm testlocally (no pnpm available in this environment); the new and updated tests follow the existing harness patterns and should be exercised in CI. Happy to iterate if maintainers prefer an alternative fix (e.g. budgeting before dedupe finalize, or a head+tail preview).Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.